<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>回复</title>
    <link rel="stylesheet" type="text/css" href="../../public/home/css/style_1_common.css" />
    <link rel="stylesheet" type="text/css" href="../../public/home/css/style_1_forum_index.css" />
    <link rel="stylesheet" id="css_extstyle" type="text/css" href="../../public/home/css/style.css" />

    <script src="../../public/home/js/forum.js" type="text/javascript"></script>
    <script src="../../public/home/js/jquery.min.js" type="text/javascript"></script>
    <script src="../../public/home/js/jquery-3.3.1.js"></script>
    <style type="text/css">
        small{font-size: 14px;color: #aaa;}
        pre{padding: 5px;background-color: #eee;}
        .textcenter{text-align: center;}
    </style>
    <style>


        #list{
            float:left;
            height:45px;
            background-color:white;
            border-radius:5px;
        }
        #list #page{
            float:left;
            width:950px;
            margin-top:8px;
        }
        #list #page #pagefy{
            float:left;
        }
        #list #page #pagefy ul{
            list-style:none;
            margin-left:18px;
        }
        #list #page #pagefy ul li{
            float:left;
            margin-left:5px;
            padding:4px 0px;
            border:1px solid #636969;
        }
        #list #page #pagefy ul li a{
            padding:5px 10px;
            color:#636969;
        }
        #list #page #pagefy ul li a:hover{
            color:white;
            background-color:#636969;
        }
        #list #page #fatie{
            float:right;
            margin-right:20px;
        }
        #list #page #fatie button{
            width:60px;
            height:30px;
            color:white;
            background-color:#fc0;
            border:1px solid #fc0;
            border-left:2px solid white;
            border-top:2px solid white;
            border-radius:5px;
            font-weight:bold;
            cursor:pointer;
        }
        #bigdetail{
            float:left;
            /*border:1px solid red;*/
        }
        #detail{
            width:950px;
            height:100%;
            float:left;
            margin-top:10px;
            border-top:3px solid #888;
            background-color:white;
        }
        #detail #lzinfo{
            width:150px;
            height:100%;
            float:left;
            border-right:1px solid #EDEDED;
            background-color:#F7F7F7;
        }
        #detail #lzinfo #read{
            width:74px;
            height:40px;
            line-height:12px;
            float:left;
            font-size:12px;
            font-weight:bold;
            border-bottom:1px solid #d9d9d9;
            border-right:1px solid #d9d9d9;
        }
        #detail #lzinfo #reply{
            width:74px;
            height:40px;
            line-height:12px;
            font-size:12px;
            float:left;
            font-weight:bold;
            border-bottom:1px solid #d9d9d9;
        }
        #detail #lzinfo #read p{
            margin-top:5px;
            text-align:center;
        }
        #detail #lzinfo #reply p{
            margin-top:5px;
            text-align:center;
        }
        #detail #lzinfo #lztoux{
            width:130px;
            /*height:459px;*/
            float:left;
            margin-left:10px;
        }
        #detail #lzinfo #lztoux #uname{
            width:115px;
            height:30px;
            float:left;
            font-size:15px;
            padding-top:2px;
            padding-left:15px;
            line-height:30px;
            margin-top:5px;

        }
        #detail #lzinfo #lztoux #uname a{
            color:black;
        }
        #detail #lzinfo #lztoux #uname a:hover{
            color:blue;
        }
        #detail #lzinfo #lztoux #utoux{
            width:120px;
            height:120px;
            padding:5px;
            float:left;
            border:1px solid #efefef;
        }
        #detail #lzinfo #lztoux #ulevel{
            width:130px;
            height:35px;
            float:left;
        }
        #detail #lzinfo #lztoux #ulevel a{
            font-size:12px;
            color:black;
        }
        #detail #lzinfo #lztoux #ulevel a:hover{
            color:blue;
        }
        #detail #lzinfo #lztoux #uhuiz{
            width:130px;
            min-height:20px;
            float:left;
            padding:2px 0px;
        }
        #detail #lzinfo #lztoux #uguanz{
            width:130px;
            height:30px;
            float:left;
        }
        #detail #lzinfo #lztoux #uguanz a{
            color:black;
            font-size:12px;
            padding-left:18px;
        }
        #detail #lzinfo #lztoux #uguanz a:hover{
            color:red;
        }
        #detail #lzinfo #lztoux #uguanz a.jia{

        }
        #detail #lzinfo #lztoux #uguanz a.fa{

        }

        #detail #tzinfo{
            width:799px;

            float:left;
        }
        #detail #tzinfo #tzbiaot{
            width:799px;
            height:40px;
            float:left;
            color:#075991;
            line-height:40px;
            background-color:#f7f7f7;
            border-bottom:1px solid #d9d9d9;
        }
        #detail #tzinfo #tzbiaot p{
            font-size:20px;
            font-weight:bold;
            margin-left:10px;
        }
        #detail #tzinfo #tzbiaot p span{
            margin-left:5px;
            font-size:13px;
        }
        #detail #tzinfo #tzbiaot p span a{
            color:#636969;
        }
        #detail #tzinfo #tzbiaot p span a:hover{
            color:blue;
        }
        #detail #tzinfo #tzxiangq{
            width:780px;
            /*min-height:440px;*/
            float:left;
            padding:10px;
        }
        #detail #tzinfo #tzxiangq #fttime{
            width:780px;
            height:30px;
            float:left;
            font-size:15px;
            line-height:30px;
            border-bottom:1px dashed #ccc;
        }
        #detail #tzinfo #tzxiangq #fttime p{
            float:left;
        }
        #detail #tzinfo #tzxiangq #fttime ul{
            list-style:none;
        }
        #detail #tzinfo #tzxiangq #fttime ul li{
            float:right;
        }
        #detail #tzinfo #tzxiangq #fttime ul li a{
            color:#636969;
            margin-left:5px;
            font-size:15px;
        }
        #detail #tzinfo #tzxiangq #fttime ul li a:hover{
            color:blue;
        }
        #detail #tzinfo #tzxiangq #tzneir{
            width:780px;
            min-height:200px;
            float:left;
            padding:10px 0px;
        }
        #detail #tzinfo #tzxiangq #tzneir p{
            font-size:15px;
        }
        #detail #tzinfo #tzxiangq #tzfenx{
            width:780px;
            height:36px;
            float:right;
            margin-left:10px;
            margin-top:10px;
        }
        #detail #tzinfo #tzxiangq #tzfenx a{
            float:right;
            margin-left:8px;
        }
        #detail #tzinfo #tzxiangq #tzyinc{
            width:600px;
            height:25px;
            float:left;
            margin-top:15px;
            border:1px dashed #ECA46A;
            background-color:#FFFAE1;
        }
        #detail #tzinfo #tzxiangq #tzyinc p{
            padding:5px 0px 0px 25px;
            font-size:15px;
            color:#636969;
        }
        #detail #tzinfo #tzxiangq #tzyinc div{
            width:15px;
            height:20px;
            float:left;
            margin-top:4px;
            margin-left:5px;

        }
        #detail #tzinfo #tzxiangq #tzpingf{
            width:775px;
            height:30px;
            float:left;
            line-height:30px;
            margin-top:10px;
            border:1px solid #ccc;

        }
        #detail #tzinfo #tzxiangq #tzpingf p{
            margin-left:8px;
            font-size:14px;
        }
        #detail #tzinfo #tzxiangq #tzpingf span{
            color:red;
            font-weight:bold;
            padding:0px 2px;
        }
        #detail #tzinfo #tzxiangq #tzpingfxx{
            width:775px;
            height:30px;
            float:left;
            border-bottom:1px dashed #ccc;
        }
        .post{color: blue;
        height: 100%;
        float: left;
        margin-top: 10px;
        border-top: 3px solid #888;
        background-color: white;}
    </style>
</head>
<?php require './head.php';?>
<div id="ct" class="ptm wp cl">
    <div class="nfl" id="main_succeed" style="display: none">
        <div class="f_c altw">
            <div class="alert_right">
                <p id="succeedmessage"></p>
                <p id="succeedlocation" class="alert_btnleft"></p>
                <p class="alert_btnleft"><a id="succeedmessage_href">如果您的浏览器没有自动跳转，请点击此链接</a></p>
            </div>
        </div>
    </div>
    <?php @$auth1 = $_COOKIE['uname1'];  @$uuid = $_COOKIE['id1'];

    ?>


    <!--引导层结束-->

    <!--分页开始-->
<?php
    $ftitle= $_GET['title'];
    $sql7 = "select * from post where title = '{$ftitle}'";
    $result7 = mysqli_query($link,$sql7);
    $rows7 = mysqli_fetch_assoc($result7);
    $aid = $rows7['id'];
    $n_like = $rows7['n_like'];
    $sql8 = "select * from post where id = $aid";
    $result8 = mysqli_query($link,$sql8);
    $rows8 = mysqli_fetch_assoc($result8);
    $cou = $rows8['count'];
    $cou++;
    $sql9 = "update post set count = $cou where id = $aid";
    mysqli_query($link,$sql9);
    $sql10 = "select count(content) as du from reply where pid = $aid and status = 1";
    $reslut10 = mysqli_query($link,$sql10);
    $rows10 = mysqli_fetch_assoc($reslut10);
    $hui = $rows10['du'];
?>
    <div id="bigdetail" style="float: none">
        <div id="detail">
                <div id="lzinfo">
                    <div id="read">
                        <p><?php echo $cou?></p>
                        <p>阅读</p>
                    </div>
                    <div id="reply">
                        <p><?php echo $hui?></p>
                        <p>回复</p>
                    </div>
                    <div id="lztoux">
                        <div id="uname">
                            <a href="#"><?php echo $_GET['auto'] ?></a>
                        </div>
                        <div id="utoux">
                            <img src="../../public/home/images/utoux.png"/>
                        </div>
                        <div id="uguanz">
                            <a href="#" class="jia">加关注</a>
                            <a href="#" class="fa">发消息</a>
                        </div>
                    </div>
                </div>
            <div id="did_one">
                <div id="tzinfo" style="height: auto">
                    <div id="tzbiaot">
                        <p><?php echo $_GET['title'] ?><span></span></p>
                    </div>

                    <div id="tzxiangq">
                        <div id="fttime">
                            <p>楼主 发表于:<?php  echo $_GET['time']?></p>
                        </div>
                        <div id="tzneir">
                            <p><?php  echo $_GET['count']?></p>
                            <div style="float: right">
                                <input id="n_like" type="hidden" name="n_like" value="<?php echo $n_like ?>">
                                <input id="uuid" type="hidden" name="uid" value="<?php echo $uuid ?>">
                                <input id="aid" type="hidden" name="aid" value="<?php echo $aid ?>">
                                <?php
                               $sql = "select * from dianzan where uid = $uuid and pid = $aid ";
                               $result = mysqli_query($link,$sql);
                               $rows = mysqli_fetch_assoc($result);
                               if ($rows['status'] == 0){
                                   echo " <button class=\"btn\">点赞</button>
                                <em id=\"nn\">{$rows7['n_like']}</em></div>";
                               }else{
                                   echo " <button class=\"btn\">已点赞</button>
                                <em id=\"nn\">{$rows7['n_like']}</em></div>";
                                }
                                ?>
                        </div>
                        <script>
                            $(function () {
                                    $('.btn').click(function () {
                                        var aid = $('#aid').val();
                                        var uid = $('#uuid').val();
                                        var n_like = $('#n_like').val();
                                        var btn = $('.btn').html();
                                        $.ajax({
                                            url: 'test.php',
                                            type: 'post',
                                            data: 'id=' + aid + "&uid=" + uid+ "&n_like=" + n_like+ "&btn=" + btn,
                                            dataType: 'json',
                                            cache: false,
                                            success: function (data) {
                                                $('#nn').html(data.n_like);
                                                $('.btn').html(data.name);
                                            }
                                        })
                                    })
                                })
                                </script>
                    </div>
                </div> </div>
        </div></div>

    <?php
    @$iid = $_GET['dudu'];
    @$ming = $_COOKIE['uname1'];
    $sql = "select * from reply where pid=$iid and status = 1";
    $result = mysqli_query($link,$sql);
    $num_All = mysqli_num_rows($result);
    //分页几条；
    $page = 4;
    //分几页,总页数；
    $page_All = ceil($num_All / $page);
    if (empty($_GET['p'])) {
        $p = 1;
    } else {
        $p = $_GET['p'];
    }
    $page_num = ($p - 1) * $page;
    $sql2 = "select * from reply where pid=$iid and status = 1 limit {$page_num},{$page}";
    $result2 = mysqli_query($link,$sql2);
    $num =$page_num;
    while($rows2 = mysqli_fetch_assoc($result2)) {
        $num++;
        $ppid = $rows2['id'];
        if ($num=='1'){
            $lou='沙发';
        }
        elseif ($num=='2'){
            $lou='板凳';
        }
        elseif($num=='3'){
            $lou='地板';
        }else {
            $lou = $num .'楼';
        }
    $uid1 = $rows2['uid'];
    $sql3 = "select * from user where id = $uid1";
    $result3 = mysqli_query($link,$sql3);
    $rows3 = mysqli_fetch_assoc($result3);
    $uname = $rows3['userName'];
    $loid = $rows3['id'];
    $sql4 = "select * from userdetail where uid = $loid";
    $result4 = mysqli_query($link,$sql4);
    $rows4 = mysqli_fetch_assoc($result4);
    $rlogo = $rows4['photo'];
    $fh='x_';
    $hz=basename($rlogo);
    $rlogo = $fh.$hz;

    ?>
<style>
    #fttime p{
        width: 780px;
        height: 30px;
        float: left;
        font-size: 15px;
        line-height: 30px;
        border-bottom: 1px dashed #ccc;
    }
    #tzinfo{float:left;width: 780px;height: 250px
    }
    #lztoux{width: 150px;border-right:1px solid #eee;float: left}
    #uname{ font-size: 18px; color: red;}
</style>

        <div id="detail" class="cycle">
            <div id="lzinfo">
                <div id="lztoux">
                    <div id="uname">
                        <a href="#"><?php echo $uname?></a>
                    </div>
                    <div id="utoux">
                        <img src="../upuser/images/<?php echo $rlogo ?>" width="130px">
                    </div>
                </div>
            </div>
            <div id="tzinfo">
                <div id="tzxiangq">
                    <div id="fttime">
                        <p><strong style='color: blue;'><?php echo $lou?></strong> 发表于:<?php echo date('Y-m-d',$rows2['ctime']);?></p>
                    </div>
                    <div id="tzneir">
                        <p><?php echo $rows2['content']?></p>

                    </div>
                </div>
            </div>
        </div>
            <?php
            }

            ?>














</div>
<div class="page" style="text-align: right">
    当前<?php echo $p;?>/<?php echo $page_All;?>页 总条数：<?php echo $num_All;?>条&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="./post.php?p=1&dudu=<?php echo $iid?>&uname=<?php echo $uname?>&rlogo=<?php echo $rlogo ?>&ctime =<?php echo $rows2['ctime'] ?>&content=<?php echo $rows2['content'] ?>&time=<?php  echo $_GET['time']?>&auto=<?php echo $_GET['auto'] ?>&count=<?php  echo $_GET['count']?>&title=<?php echo $_GET['title'] ?>">首页</a>&nbsp;&nbsp;&nbsp;
    <a href="./post.php?p=<?php echo $p<=1?1:($p-1)?>&dudu=<?php echo @$iid?>&uname=<?php echo $uname ?>&rlogo=<?php echo $rlogo ?>&ctime =<?php echo $rows2['ctime'] ?>&content=<?php echo $rows2['content'] ?>&time=<?php  echo $_GET['time']?>&auto=<?php echo $_GET['auto'] ?>&count=<?php  echo $_GET['count']?>&title=<?php echo $_GET['title'] ?>">上一页</a>&nbsp;&nbsp;&nbsp;
    <a href="./post.php?p=<?php echo $p>=$page_All?$page_All:($p+1)?>&dudu=<?php echo @$iid?>&uname=<?php echo $uname ?>&rlogo=<?php echo $rlogo ?>&ctime =<?php echo $rows2['ctime'] ?>&content=<?php echo $rows2['content'] ?>&time=<?php  echo $_GET['time']?>&auto=<?php echo $_GET['auto'] ?>&count=<?php  echo $_GET['count']?>&title=<?php echo $_GET['title'] ?>">下一页</a>&nbsp;&nbsp;&nbsp;
    <a href="./post.php?p=<?php echo $page_All;?>&dudu=<?php echo @$iid?>&uname=<?php echo $uname ?>&rlogo=<?php echo $rlogo ?>&ctime =<?php echo $rows2['ctime'] ?>&content=<?php echo $rows2['content'] ?>&time=<?php  echo $_GET['time']?>&auto=<?php echo $_GET['auto'] ?>&count=<?php  echo $_GET['count']?>&title=<?php echo $_GET['title'] ?>">尾页</a>&nbsp;&nbsp;&nbsp;
</div>
<!--分页结束-->

<!--楼主帖子详情结束-->

<!--楼主帖子详情结束-->
<div id="editNotice" style="padding: 10px;text-align: right">
    <?php
    if (!empty($_COOKIE['id1'])){
        echo " <button class=\"reply_one\" >回复</button>";
    }else{
        echo " <button onclick=\"jquery:alert('请先登录')\" >回复</button>";
    }
    ?>
</div>
<span id="pid1" style="display: none;"><?php echo $uuid?></span>
<span id="pid" style="display: none;"><?php echo $_GET['dudu']?></span>
<span id="mid" style="display: none"><?php echo $num?></span>
<span id="mname" style="display: none"><?php echo $ming?></span>
<textarea id="editor" name="editor" rows="5" style="display: none;"></textarea>
<script src="../../public/home/bian/HandyEditor.min.js"></script>
<script type="text/javascript">
    var he = HE.getEditor('editor');
</script>
<script type="text/javascript">
    $(function () {
        $(".reply_one").click(function () {
            v_content = he.getHtml();
            var pid = $('#pid').html();
            var mid = $('#mid').html();
            var mname = $('#mname').html();
            var pid1 = $('#pid1').html();
            var did = $("#did_one");
            $.ajax({
                url:'reply.php',
                type:'post',
                dataType:'json',
                data:'v_content='+v_content +'&pid='+pid +'&pid1='+pid1+'&mid='+mid+'&mname='+mname,
                success:function (data) {
                    if(data.error==1){
                        alert('内容不能为空');
                    }else{
                        if($(".cycle").attr('class')=='cycle'){
                            did = $('.cycle').last();
                            var str = "<div id='detail' class='cycle'>";
                            str += "<div id='lzinfo'>";
                            str += "<div id='lztoux'>";
                            str += "<div id='uname'>";
                            str += "<a href='#'>"+data.ming+"</a>";
                            str += "</div>";
                            str += "<div id='utoux'>";
                            str += "<img src='../upuser/images/"+data.logo+"'/>";
                            str += "</div>";
                            str += "</div>";
                            str += "</div>";
                            str += "<div id='tzinfo'>";
                            str += "<div id='tzxiangq'>";
                            str += "<div id='fttime'>";
                            str += "<p><strong style='color: blue;'>"+data.num+"</strong>发表于:"+data.ctime+"</p>";
                            str += "</div>";
                            str += "<div id='tzneir'>";
                            str += "<p>"+data.content+"</p>";
                            str += "</div>";
                            str += "</div>";
                            str += "</div>";
                            str += "</div>";
                            did.append(str);
                        }else{
                            var str = "<div id='detail' class='cycle'>";
                            str += "<div id='lzinfo'>";
                            str += "<div id='lztoux'>";
                            str += "<div id='uname'>";
                            str += "<a href='#'>"+data.ming+"</a>";
                            str += "</div>";
                            str += "<div id='utoux'>";
                            str += "<img src='../upuser/images/"+data.logo+"'/>";
                            str += "</div>";
                            str += "</div>";
                            str += "</div>";
                            str += "<div id='tzinfo'>";
                            str += "<div id='tzxiangq'>";
                            str += "<div id='fttime'>";
                            str += "<p><strong style='color: blue;'>"+data.num+"</strong>发表于:"+data.ctime+"</p>";
                            str += "</div>";
                            str += "<div id='tzneir'>";
                            str += "<p>"+data.content+"</p>";
                            str += "</div>";
                            str += "</div>";
                            str += "</div>";
                            str += "</div>";
                            did.append(str);
                        }

                    }

                }
            });
        })
    })
</script>
</div>
<?php require './footer.php';?>
</body>
</html>


